package com.ssms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssms.domain.Teacher;
import com.ssms.mapper.TeacherMapper;
import com.ssms.service.TeacherService;
import com.ssms.utils.JwtUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements TeacherService{
    @Override
    public String createToken(Teacher teacher) {
        Map tokenMap = new HashMap();
        tokenMap.put("id",teacher.getTeacherId());
        tokenMap.put("number",teacher.getTeacherNum());
        tokenMap.put("name",teacher.getTeacherName());
        tokenMap.put("role",teacher.getRole());
        String token = JwtUtils.getToken(tokenMap);
        return token;
    }

}
